package cn.tedu.admin.companyandjob.service.impl;

import cn.tedu.admin.companyandjob.dao.persist.repository.ICompanyRepository;
import cn.tedu.admin.companyandjob.pojo.entity.CompanyDetail;
import cn.tedu.admin.companyandjob.pojo.param.CompanyParam;
import cn.tedu.admin.companyandjob.pojo.vo.CompanyListItemVO;
import cn.tedu.admin.companyandjob.service.ICompanyService;
import cn.tedu.common.pojo.vo.PageData;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class CompanyServiceImpl implements ICompanyService {

    @Autowired
    ICompanyRepository iCompanyRepository;
    @Override
    public PageData<CompanyListItemVO> list(Integer pageNum) {
        return iCompanyRepository.selectList(pageNum,10);
    }

    //修改公司信息
    @Override
    public void updataCompany(Long companyId,CompanyParam companyParam) {
        CompanyDetail companyDetail = new CompanyDetail();
        BeanUtils.copyProperties(companyParam,companyDetail);
        companyDetail.setId(companyId);
        iCompanyRepository.updataCompany(companyDetail);
    }

    @Override
    public void deleteCompany(Long companyId) {
        iCompanyRepository.deleteCompany(companyId);
    }


}
